﻿@{
    ViewBag.Title = "Home";
    string[] names = Enum.GetNames(typeof(CasaElectronica.Controllers.Categoria));    
}

<style type="text/css">
    table thead.pimp 
    {
        background-color: purple;
        color: yellow;
    }
    td
    {
        background-color: brown;
        color: yellow;
    }
</style>

<h1>Home</h1>
<p><a href="@Url.Action("ABM")">ABM</a></p>
<p><a href="@Url.Action("Changuito")">Changuito</a></p>

<h2>Lista Actual</h2>
<form action="/Electro/Ordenar" method="post">
    <label>
        <span>Ordenar por: </span>
        <select name="categoria">
            @for (int i = 0; i<names.Length; i++) 
            {
                var s = names[i];
                <option value="@i">@s</option>
            }
    </select>
    </label>
    <input type="submit" value="Ordenar" />
</form>
<table border= "1">
<thead class="pimp">
    <tr>
        <th>Nombre</th>
        <th>Categoria</th>
        <th>Cantidad</th>
        <th>Precio</th>
    </tr>
</thead>
<tbody>
    @{
        int co = 0;
        foreach (var i in Model)
        {
            <tr>
                <td>@i.nombre</td>
                <td>@i.categoria</td>
                <td>@i.cantidad</td>
                <td>@i.precio</td>
            </tr>
            co++;
        }
    }   
</tbody>
</table>